#ifndef _CONAX_MMI_H_
#define _CONAX_MMI_H_

#define SUBSCRIP_ENQUIRE	1
#define EVENT_ENQUIRE		2
#define PURSE_ENQUIRE		3
#define DEBIT_ENQUIRE		4
#define CREDIT_ENQUIRE		5

#define MAT_G_VAL			1
#define MAT_PG_VAL			2
#define MAT_A_VAL			4
#define MAT_X_VAL			8

struct date{
	UINT16 year;
	UINT8 month;
	UINT8 day;
};
struct subscription_status_info{
	UINT16 subscrip_ref;
	UINT8 name[64];
	struct date start_date;
	struct date end_date;
	UINT8 entitle[4];
	struct date pre_start_date;
	struct date pre_end_date;
	UINT8 pre_entitle[4];
};

struct detail_time{
	UINT16 year;
	UINT32 month	:4;
	UINT32 reserved 	:4;
	UINT32 day		:5;
	UINT32 hour		:5;
	UINT32 minute	:6;
	UINT32 sec      :8;
};
struct event_sta_info{
	UINT32 event_tag	:24;
	UINT8 auth_type;
	UINT8 name[64];
	struct detail_time auth_start;
	struct detail_time auth_end;
	UINT16 minute_left;
	UINT16 credit_left;
};
struct purse_status{
	UINT16 purse_ref;
	UINT8 name[64];
	UINT32 balance;
};
struct init_info{
	UINT16 ca_sys_id;
	UINT16 country_indi;
	UINT8 version;
	UINT8 mat_rat_value;
	UINT8 num_of_session;
	UINT8 reserved;
	UINT32 card_numer;
};

struct debit_status{
	UINT32 event_tag;
	UINT32 consumed_token;
	struct detail_time last_access_time;
	UINT8 name[64];
};

struct credit_status{
	INT32 credit_token;
	UINT8 name[64];
};

typedef struct{
	struct detail_time utc_time;
	UINT8 pi_seq_num;
	UINT8 pi_txt_length;
	UINT16 pi_duration;
	UINT8 pi_repet;
	UINT8 pi_interv;
	UINT8 txt[256];
	UINT8 mail_flg;
}pi_txt_inf;
typedef struct{
	UINT32 event_cost;
	UINT32 balance;
	UINT8 reserved			:6;
	UINT8 insuffic_tokens		:1;
	UINT8 tokens_mode		:1;
	UINT8 label[64];
	UINT8 txt[256];
}token_info;

typedef struct{
	UINT16 minutes;
	UINT8 label[64];
}view_info;

typedef struct{
	UINT32 pro_id;
	UINT16 price_integer;
	UINT8 price_decimal;
	UINT8 reserved;
	UINT8 currence[4];
	UINT8 label[64];
}order_inf;
/*
typedef struct{
	UINT8 hh		:5;
	UINT8 mm	:6;
	UINT8 ss		:6;
	UINT8 cs		:7;
}utc_info;
*/

struct utc_info{
	UINT8 hh		:5;
	UINT8 mm	:6;
	UINT8 ss		:6;
	UINT8 cs		:7;
};

typedef struct{
	struct utc_info utc_time;
	UINT8 height;
	UINT16 duration;
	UINT16 pos_x;
	UINT16 pos_y;
	UINT8 fp_id[256];
}finger_inf;
void enquire_status(UINT8 select, UINT8 *cnt, UINT16 para16, UINT8 *buf);
INT8 conax_pin_change(UINT8 *old_pin, UINT8 *new_pin);
INT8 conax_matur_change( UINT8 mat_value, UINT8 *pin);
void get_cur_mat_value(UINT8 *mat_val);
INT8 cass_init_info( struct init_info *info);
INT8  pin_check(UINT8 *old_pin, UINT8 pin_use);
INT8  pin_check_multi_des(UINT8 *old_pin, UINT8 pin_use, UINT32 prog_id);
void LUHN_compute(char *s, char *c, UINT8 *cnt);
UINT8 conax_get_hostmessage_info(pi_txt_inf *inter_info, UINT8 index);
void conax_get_token_info(token_info *inter_token);
void conax_get_view_info(view_info *inter_token);
void conax_get_order_info(order_inf *inter_token);
void conax_get_finger_info(finger_inf *inter_token);
void conax_get_finger_info_multi_des(finger_inf *inter_token,UINT8 index);
UINT8 conax_get_access_info(UINT8 *mat_value, UINT8 index);
INT8 conax_get_msg_info(UINT8 *buf, UINT8 index);
BOOL conax_msg_start(UINT8 flag);
INT32 conax_erase_message();
BOOL conax_mail_indic(void);
BOOL conax_mail_set(UINT8 index);
INT32 conax_set_pid(UINT16 pid);

void conax_remove_mutex();
UINT8 * conax_get_mail();
INT8 conax_get_mail_info(UINT8 *buf, UINT8 index);
INT8 conax_get_msg_type(UINT8 *type,UINT8 index);
INT32 conax_get_mail_number();
BOOL conax_mail_delete(UINT8 index);
UINT8 conax_is_card_ok();
INT32 conax_card_stb_status();
#endif
